package demo;

import java.text.MessageFormat;


public class Test {
	public static String format(String value, Object... params) {
		if (BooleanUtils.isEmpty(value) || BooleanUtils.isEmpty(params)) {
			return null;
		}
		return MessageFormat.format(value, params);
	}
	
	public static void main(String[] args) {
		String payUrl = "http://testddpay.diandianwaimai.com/memRechargePay/pay?mobile={0}&shop_id={1}&order_id={2}&order_price={3}&pay_price={4}&account_id={5}&card_code={6}&wx_open_id={7}";
		System.out.println(payUrl);
		payUrl = format(payUrl, "13555555555", "20826", "11", "88", "66", "55", "68", "");
		System.out.println(payUrl);
	}
	
	
}


/**
 * boolean工具类
 * 
 * @author wupengfei
 *
 */
abstract class BooleanUtils {

	/**
	 * 判断参数是否为空
	 * 
	 * @param params
	 * @return
	 */
	public static boolean isEmpty(String... params) {
		if (params == null || params.length == 0) {
			return true;
		}
		return false;
	}

	/**
	 * 判断参数是否为空
	 * 
	 * @param params
	 * @return
	 */
	public static boolean isEmpty(Object... params) {
		if (params == null || params.length == 0) {
			return true;
		}
		return false;
	}

}
